package test.plural;

import static test.plural.Complex.module;

public class ComplexDemo {
    public static void main(String[] args) {
        Complex com1 = new Complex(1, 2);
        com1.print();
        Complex com2 = new Complex(3, 4);
        com2.print();
        Complex com3 = new Complex(5, 6);
        com3.print();
        Complex com4 = new Complex(4, 8);
        com4.print();
        Complex com5 = new Complex(0, 0);
        System.out.println("复数加法：");
        com5 = com5.add(com1, com2);
        com5.print();//(1.0+2.0i)+(3.0+4.0i)=4.0+6.0i
        System.out.println("-----------------------");
        System.out.println("复数减法：");
        com5 = com5.subduction(com2, com3);//(3.0+4.0i)+(5.0+6.0i)=-2.0-2.0i
        com5.print();
        System.out.println("-----------------------");
        System.out.println("复数乘法：");
        com5 = com5.multiplication(com3, com4);//(5.0+6.0i)*(4.0+8.0i)=-28.0+64.0i
        com5.print();
        System.out.println("-----------------------");
        System.out.println("复数除法：");//(1.0+2.0i)/(4.0+8.0i)=0.25+0.0i
        com5 = com5.dividion(com1, com4);
        com5.print();
        System.out.println("-----------------------");
        System.out.println("复数的模：");
        double x = module(com2);
        System.out.println(x);//|3.0+4.0i|=5.0
        System.out.println("-----------------------");
    }

}
